package com.gitee.wsl.compose.ext.resource

import androidx.compose.runtime.Composable
import androidx.compose.runtime.NonSkippableComposable
import org.jetbrains.compose.resources.PluralStringResource
import org.jetbrains.compose.resources.StringArrayResource
import org.jetbrains.compose.resources.StringResource
import org.jetbrains.compose.resources.pluralStringResource
import org.jetbrains.compose.resources.stringArrayResource
import org.jetbrains.compose.resources.stringResource


@Composable
@NonSkippableComposable
 fun StringArrayResource.strings(): List<String> = stringArrayResource(this)

@Composable
@NonSkippableComposable
 fun StringResource.string(
    vararg args: Any,
    trim: Boolean = true
): String = stringResource(this, formatArgs = args).let { if (trim) it.trim() else it }

@Composable
@NonSkippableComposable
 fun PluralStringResource.plural(
    quantity: Int,
    vararg args: Any
): String = pluralStringResource(this, quantity, formatArgs = args)

 suspend fun StringResource.getString(
    vararg args: Any,
    trim: Boolean = true
): String = org.jetbrains.compose.resources.getString(this, formatArgs = args).let { if (trim) it.trim() else it }
